const db = require("../../dataBase/db");
module.exports = {
  url: "/user/update",
  method: "get",
  controller: async function(ctx, next) {
    console.log("执行更新");
    let obj = ctx.params;
    let repos = db.getList() || [];
    repos.forEach(function(item, index) {
      if (item.name === obj.name || item.age === obj.age)
        db.update(index, JSON.parse(data));
    });
    ctx.body = {
      data: db.getList(),
      msg: "更新成功"
    };
  }
};
